<?php
require 'app/auth/models/init.php';
require 'app/auth/controllers/autoLogin.php';
?>


<nav class="navbar fixed-top navbar-expand-lg bg-body-tertiary">
    <div class="container-fluid">
        <a class="navbar-brand" href="/" style="margin-left: 20px;transform: translateY(-6px);">
            <div style="border-radius: 50%; overflow: hidden; display: inline-block;transform: translateY(8px);">
                <img src="/public/images/logo.jpg" height="35px" alt="">
            </div>

            <span>编程论坛</span>
        </a>
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarSupportedContent">
            <ul class="navbar-nav me-auto mb-2 mb-lg-0">
                <li class="nav-item">
                    <a class="nav-link active" aria-current="page" href="/">首页</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="/app/add/views/add.php">写文章</a>
                </li>
            </ul>

            <div class="uright">
                <?php
                if (!session_id()) session_start();
                if (isset($_SESSION['user_state'])) {
                    echo "<div class='tx-a'>";
                    echo "<div class='uright-div'>";
                    echo "<img alt='' src='/public/images/mr.webp' width='30px' height='30px'/>";
                    echo "<a class='u-a' href='/app/auth/controllers/login.php?loginout=true'>注销</a>";
                    echo "</div>";
                    echo '</div>';
                } else {
                    echo "<a class='tx-a' style='text-decoration: none;' href='/app/auth/views/login.html'>";

                    echo "<div onmousemove=this.title='请点击进行登录'>";
                    echo "<img src='/public/images/mr_b.webp' width='30px' height='30px' alt='无法显示'>";
                    echo "<span style='margin-left:10px;'>登录</span>";
                    echo "</div>";
                    echo '</a>';
                }
                ?>
            </div>
        </div>
    </div>
</nav>